#define _CRT_SECURE_NO_WARNINGS   1


#include<iostream>
#include<string>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int *a;
	a = new int[n];
	int couter = 0;
	while (n--){
		string op;
		cin >> op;
		int num1, num2;
		if (op == "insert"){
			cin >> num1 >> num2;
			if (couter == 0){
				a[0] = num2;
				couter++;
			}
			else{
				int set = -1;
				for (int i = 0; i<couter; i++){
					if (a[i] == num1){
						set = i;
						break;
					}
				}
				if (set == -1){
					a[couter++] = num2;
				}
				else{
					for (int i = couter; i>set; i--){
						a[i] = a[i - 1];
					}
					a[set] = num2;
					couter++;
				}
			}
		}
		else {
			cin >> num1;
			int set = -1;
			for (int i = 0; i<couter; i++){
				if (a[i] == num1) {
					set = i;
					break;
				}
			}
			if (set != -1){
				for (int i = set; i<couter - 1; i++){
					a[i] = a[i + 1];
				}
				couter--;
			}
		}
	}
	if (couter == 0) cout << "NULL";
	else{
		for (int i = 0; i<couter; i++) {
			cout << a[i] << " ";
		}
	}
}